let mongoose = require('../util/DBUtil')


var studentSchema = mongoose.Schema({
   name:String,
   age:Number,
   gender:String,
   tel:String,
   // classId:String
   classId:{
      //指的就是学生表中classid的类型
      type: mongoose.Schema.Types.ObjectId,
      //引用的模型
      ref:"classModel"
  },

});

var studentModel = mongoose.model('studentModel', studentSchema,"students");


var classSchema = mongoose.Schema({
   name:String
   });
var classModel = mongoose.model('classModel', classSchema,"class");

// let result = studentModel.find().populate("classId").exec()
// result.then((data)=>{
//        console.log(data)
//  }) 


module.exports=studentModel;
// module.exports=classModel;

